GBML manual / Link Cable

link_dx

The horizontal axis of a player’s d-pad, like btn_dx but for any player on the link cable: -1 (Left), 0, or 1 (Right). Both held at once cancels to 0, and a player who is not there is 0.

Works differently on Game Boy - The Game Boy link cable joins two consoles, not four: players 3 and 4 are never there and read as not pressing anything, and the two consoles decide between themselves which one is player 1, so it can be a different one each time they meet.

Works differently on Game Boy Color - The Game Boy Color link cable joins two consoles, not four: players 3 and 4 are never there and read as not pressing anything, and the two consoles decide between themselves which one is player 1, so it can be a different one each time they meet.

On other consoles this differs: see Side by side and How the consoles differ.

Syntax

link_dx(player) -> int

Arguments

NameType
playerint

Returns

int

Description

The horizontal axis of player player's d-pad, read as a single number: -1 while Left is held, 1 while Right is held, 0 otherwise. Holding both at once cancels back to 0. It is btn_dx for any player on the link cable.

A player who is not there, or a number that is not a player, is 0, so movement code does not need a special case for a missing player.

Example

x += link_dx(2) * 2;

Moves this square with player 2's d-pad, on both consoles.

See also: link_dybtn_dxlink_button_heldThe link cable